package dry.example.route;

import dry.example.service.RouteService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @author zc
 */
@Component
public class RouteAdmin implements InitializingBean {

    @Autowired
    ApplicationContext applicationContext;

    @Autowired
    RouteService routeService;

    @Override
    public void afterPropertiesSet() {
        // this/new DemoApp()/SpringUtil.getBean(DemoApp.class)/applicationContext.getBean(DemoApp.class)
        routeService.run(applicationContext.getBean(DemoApp.class));
    }

}
